package com.hzhr.iot.device.controller;

import com.hzhr.iot.core.annotation.ApiImplicitInternalParams;
import com.hzhr.iot.core.annotation.Author;
import com.hzhr.iot.core.dto.ResponseExceptionDto;
import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.device.controller.base.BaseController;
import com.hzhr.iot.device.model.concentrator_meter.Concentrator_MeterDeleteModel;
import com.hzhr.iot.device.model.concentrator_meter.Concentrator_MeterGetModel;
import com.hzhr.iot.device.model.concentrator_meter.Concentrator_MeterPostModel;
import com.hzhr.iot.device.model.concentrator_meter.Concentrator_MeterPutModel;
import com.hzhr.iot.device.service.Concentrator_MeterService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

@Api(tags = "Concentrator_Meter", description = "集中器下的表具")
@RestController
@RequestMapping(value = "")
public class Concentrator_MeterController extends BaseController {
    @Autowired
    Concentrator_MeterService concentrator_meterService;

    //region /concentrators/{concentratorId}/meters GET
    //region swagger响应码 : getByConcentratorId
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
    })
    //endregion
    //region swagger说明 : getByConcentratorId
    @ApiOperation(value="查询用户所在物联网设备公司下的集中器下的表具", notes="查询用户所在物联网设备公司下的集中器下的表具  \n简介 : 查询用户所在物联网设备公司下的集中器下的表具  \n步骤 :  \n1. 查询集中器下的表具 :  \n根据条件参数查询CollectDeviceEntityExt对象列表collectDeviceList_1及总数，  \n额外查询条件如下：  \n          CollectDeviceEntityExt.categoryCode = deviceOptions.getCode('COLLECT_DEVICE_CATEGORY','LORA_METER')；  \n          CollectDeviceEntityExt.iotDeviceId = 路径参数concentratorId；  \n          CollectDeviceEntityExt.iotDeviceExt.companyId = 登录用户.companyId；  \n2. 返回信息 :  \n根据条件参数，将collectDeviceList_1及总数组装成结果对象并返回；  \n",produces = "application/json")
    //endregion
    //region swagger参数 : getByConcentratorId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "concentratorId", value = "集中器编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_id", value = "筛选条件 : where Concentrator_MeterModel.id = #{equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_code", value = "筛选条件 : where Concentrator_MeterModel.code = #{equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_des", value = "筛选条件 : where Concentrator_MeterModel.des like #{like_des} + '%'",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime >= #{greaterthanorequal_createTime}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime < #{less_createTime}",required = false, dataType = "int", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_id", value = "筛选条件 : where Concentrator_MeterModel.id = #{_equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_code", value = "筛选条件 : where Concentrator_MeterModel.code = #{_equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_des", value = "筛选条件 : where Concentrator_MeterModel.des like #{_like_des} + '%'",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime >= #{_greaterthanorequal_createTime}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime < #{_less_createTime}",required = false, dataType = "int", paramType = "query"),

    })
    //endregion
    //region 请求 : getByConcentratorId
    @RequestMapping(value = "/concentrators/{concentratorId}/meters", method = RequestMethod.GET)
    //endregion
    @Author
    public ResponseEntity<Concentrator_MeterGetModel> getByConcentratorId(@PathVariable("concentratorId") Integer concentratorId, @RequestParam @ApiIgnore Map<String, Object> query) throws ServiceException {
        Concentrator_MeterGetModel responseBody = concentrator_meterService.getByConcentratorId(initHeader(),concentratorId, query);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion

    //region /v1/concentrators/{concentratorId}/meters GET
    //region swagger响应码 : getByConcentratorId1
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
    })
    //endregion
    //region swagger说明 : getByConcentratorId1
    @ApiOperation(value="查询集中器下的表具", notes="查询集中器下的表具  \n简介 : 查询集中器下的表具  \n步骤 :  \n1. 查询集中器下的表具 :  \n根据条件参数查询CollectDeviceEntityExt对象列表collectDeviceList_1及总数，  \n额外查询条件如下：  \n          CollectDeviceEntityExt.categoryCode = deviceOptions.getCode('COLLECT_DEVICE_CATEGORY','LORA_METER')；  \n          CollectDeviceEntityExt.iotDeviceId = 路径参数concentratorId；  \n2. 返回信息 :  \n根据条件参数，将collectDeviceList_1及总数组装成结果对象并返回；  \n",produces = "application/json")
    //endregion
    //region swagger参数 : getByConcentratorId1
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "concentratorId", value = "集中器编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_id", value = "筛选条件 : where Concentrator_MeterModel.id = #{equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_code", value = "筛选条件 : where Concentrator_MeterModel.code = #{equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "like_des", value = "筛选条件 : where Concentrator_MeterModel.des like #{like_des} + '%'",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime >= #{greaterthanorequal_createTime}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "less_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime < #{less_createTime}",required = false, dataType = "int", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_id", value = "筛选条件 : where Concentrator_MeterModel.id = #{_equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_code", value = "筛选条件 : where Concentrator_MeterModel.code = #{_equal_code}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_like_des", value = "筛选条件 : where Concentrator_MeterModel.des like #{_like_des} + '%'",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime >= #{_greaterthanorequal_createTime}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_less_createTime", value = "筛选条件 : where Concentrator_MeterModel.createTime < #{_less_createTime}",required = false, dataType = "int", paramType = "query"),

    })
    //endregion
    //region 请求 : getByConcentratorId1
    @RequestMapping(value = "/v1/concentrators/{concentratorId}/meters", method = RequestMethod.GET)
    //endregion
    @Author
    public ResponseEntity<Concentrator_MeterGetModel> getByConcentratorId1(@RequestParam @ApiIgnore Integer concentratorId, Map<String, Object> query) throws ServiceException {
        Concentrator_MeterGetModel responseBody = concentrator_meterService.getByConcentratorId1(initHeader(), concentratorId, query);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion

    //region /concentrators/{concentratorId}/meters POST
    //region swagger响应码 : postByConcentratorId
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
            @ApiResponse(code = 403, message = "----异常代码 : 201  \n----异常类型 : 业务流程异常  \n----异常业务 : 查询集中器  \n----异常说明 : 集中器不存在  \n\n----异常代码 : 202  \n----异常类型 : 业务流程异常  \n----异常业务 : 验证表具代码  \n----异常说明 : 表具代码已存在  \n\n", response = ResponseExceptionDto.class),
    })
    //endregion
    //region swagger说明 : postByConcentratorId
    @ApiOperation(value="在用户所在物联设备公司下的集中器下新增表具", notes="在用户所在物联设备公司下的集中器下新增表具  \n步骤 :  \n1. 查询集中器：在用户所在的物联网公司下查询集中器,如果集中器不存在，抛出异常“集中器不存在”  \n2. 验证表具代码：表具代码全局唯一  \n3. 创建表具：在集中器下创建表具  \n4. 发送指令到集中器：如果该集中器使用的是“重燃集中器协议”，须发送“增加下级表具”指令到集中器  \n5. 返回信息  \n",produces = "application/json")
    //endregion
    //region swagger参数 : postByConcentratorId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "concentratorId", value = "集中器编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    //endregion
    //region 请求 : postByConcentratorId
    @RequestMapping(value = "/concentrators/{concentratorId}/meters", method = RequestMethod.POST)
    //endregion
    @Author
    public ResponseEntity<Concentrator_MeterGetModel> postByConcentratorId(@PathVariable("concentratorId") Integer concentratorId,
                                                                           @RequestParam @ApiIgnore Map<String, Object> query,
                                                                           @RequestBody Concentrator_MeterPostModel body) throws ServiceException {
        Concentrator_MeterGetModel responseBody = concentrator_meterService.postByConcentratorId(initHeader(), concentratorId, query, body);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
    }
    //endregion

    //region /concentrators/{concentratorId}/meters/{id} PUT
    //region swagger响应码 : putByConcentratorIdAndId
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
            @ApiResponse(code = 403, message = "----异常代码 : 201  \n----异常类型 : 业务流程异常  \n----异常业务 : 查询集中器下的表具  \n----异常说明 : 查询集中器下的表具不存在  \n\n----异常代码 : 202  \n----异常类型 : 业务流程异常  \n----异常业务 : 验证修改信息  \n----异常说明 : 表具代码已存在  \n\n", response = ResponseExceptionDto.class),
    })
    //endregion
    //region swagger说明 : putByConcentratorIdAndId
    @ApiOperation(value="在用户所在物联设备公司下的集中器下修改表具", notes="在用户所在物联设备公司下的集中器下修改表具  \n简介 : 在用户所在物联设备公司下的集中器下修改表具  \n步骤 :  \n1. 查询集中器下的表具：  \n查询CollectDeviceEntityExt对象colletDevice_1, 筛选规则如下：  \n          CollectDeviceEntityExt.id = 路径参数id；  \n          CollectDeviceEntityExt.iotDeviceId = 路径参数concentratorId；  \n          CollectDeviceEntityExt.categoryCode = deviceOptions.getCode('COLLECT_DEVICE_CATEGORY','LORA_METER')；  \n          CollectDeviceEntityExt.iotDeviceExt.companyId = 登录用户.companyId；  \n如果collectDevice_1不存在，抛出异常201；  \n2. 验证修改信息 :  \n(1) 验证表具代码：  \n          如果body.code != colletDevice_1.code，并且存在CollectDeviceEntity对象满足以下条件，则抛出异常202：  \n              CollectDeviceEntity.code = body.code；  \n3. 更新表具 :  \n根据body更新collectDevice_1；  \n4. 返回信息 :  \n根据条件参数查询更新后的collectDevice_1，然后根据查询结果组装结果对象并返回；  \n",produces = "application/json")
    //endregion
    //region swagger参数 : putByConcentratorIdAndId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "concentratorId", value = "集中器编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "id", value = "编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    //endregion
    //region 请求 : putByConcentratorIdAndId
    @RequestMapping(value = "/concentrators/{concentratorId}/meters/{id}", method = RequestMethod.PUT)
    //endregion
    @Author
    public ResponseEntity<Concentrator_MeterGetModel> putByConcentratorIdAndId(@PathVariable("concentratorId") Integer concentratorId,
                                                                               @PathVariable("id") Integer id,
                                                                               @RequestParam @ApiIgnore Map<String, Object> query,
                                                                               @RequestBody Concentrator_MeterPutModel body) throws ServiceException {
        Concentrator_MeterGetModel responseBody = concentrator_meterService.putByConcentratorIdAndId(initHeader(), concentratorId, id, query, body);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion

    //region /concentrators/{concentratorId}/meters/{id} DELETE
    //region swagger响应码 : deleteByConcentratorIdAndId
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
    })
    //endregion
    //region swagger说明 : deleteByConcentratorIdAndId
    @ApiOperation(value="在用户所在物联设备公司下的集中器下删除表具", notes="在用户所在物联设备公司下的集中器下删除表具  \n简介 : 在用户所在物联设备公司下的集中器下删除表具  \n步骤 :  \n1. 查询集中器：在用户所在的物联网公司下查询集中器,如果集中器不存在，抛出异常“集中器不存在”  \n2. 删除表具：在集中器下删除指定表具  \n3. 发送指令到集中器：如果该集中器使用的是“重燃集中器协议”，须发送“删除下级表具”指令到集中器  \n4. 返回信息  \nresult.changeCount = 删除数量  \n",produces = "application/json")
    //endregion
    //region swagger参数 : deleteByConcentratorIdAndId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "concentratorId", value = "集中器编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "id", value = "编号",required = true, dataType = "int", paramType = "path"),
    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),
    })
    //endregion
    //region 请求 : deleteByConcentratorIdAndId
    @RequestMapping(value = "/concentrators/{concentratorId}/meters/{id}", method = RequestMethod.DELETE)
    //endregion
    @Author
    public ResponseEntity<Concentrator_MeterDeleteModel> deleteByConcentratorIdAndId(@PathVariable("concentratorId") Integer concentratorId,
                                                                                     @PathVariable("id") Integer id,
                                                                                     @RequestParam @ApiIgnore Map<String, Object> query) throws ServiceException {
        Concentrator_MeterDeleteModel responseBody = concentrator_meterService.deleteByConcentratorIdAndId(initHeader(), concentratorId, id, query);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion
}
















































































































































































































































































































































































































































































































































































































